@import '../../style/theme/color';
@import '../../style/core/font';

.code-box {
    border: 1px solid $devui-line;
    border-radius: 4px;
    display: inline-block;
    width: 100%;
    position: relative;
    margin: 4px 0;
    transition: all 0.2s;
}

.devui-code-copy {
    fill: $devui-text;
}

.code-box-demo {
    border-bottom: 1px solid $devui-dividing-line;
    padding: 42px 20px 50px;
}

.code-box-meta.markdown {
    position: relative;
    padding: 10px 40px;
    border-radius: 0 0 4px 4px;
    transition: background-color 0.4s;
    width: 100%;
    font-size: $devui-font-size;
    margin-bottom: 0;
    overflow-x: unset;
}

.code-box.expand .code-box-meta {
    border-radius: 0;
    border-bottom: 1px dashed $devui-dividing-line;
}

.code-box-title {
    position: absolute;
    top: -14px;
    padding: 1px 8px;
    color: #777777;
    border-radius: 4px 4px 0 0;
    background: $devui-base-bg;
    transition: background-color 0.4s;
}

.code-box-title > a {
    color: rgba(0, 0, 0, 0.65);
    font-size: $devui-font-size-card-title;
    font-weight: 500;
    text-decoration: none;
}

.code-box .collapse {
    display: block; /* .collapse conflick with bootstrap */
    position: absolute;
    left: 15px;
    // background: $devui-block;
    top: -9px;
    cursor: pointer;
    width: 16px;
    height: 16px;
    line-height: 16px;
    opacity: 0.55;
    text-align: center;
    transition: all 0.3s;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;

    & > svg > path {
        fill: $devui-text;
    }
}

.dark-mode .code-box .collapse {
    opacity: 1;
}

.code-box .highlight-wrapper {
    display: none;
    overflow: auto;
    border-radius: 0 0 4px 4px;
}

.code-box .highlight-wrapper-expand {
    display: block;
}

.code-box .highlight {
    padding: 5px;
    position: relative;
}

.code-box-actions {
    position: absolute;
    top: 10px;
    right: 12px;
    text-align: right;
    cursor: pointer;
}

.code-box-code-copy:hover {
    color: #108ee9;
    -webkit-transform: scale(1.2);
    transform: scale(1.2);
}

.code-box-code-copy {
    font-size: $devui-font-size-card-title;
    cursor: pointer;
    color: #222222;
    transition: all 0.24s;
    background: $devui-base-bg;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    border-radius: 20px;
    opacity: 0;
}

.code-box .highlight pre {
    margin: 0;
    padding: 0;
}

.code-box pre {
    margin: 0;
    width: auto;
    border: none;
    margin-top: 10px;
}

.code-box pre code {
    border: none;
}

.highlight-wrapper:hover .code-box-code-copy,
.highlight-wrapper:hover .code-box-codepen,
.highlight-wrapper:hover .code-box-riddle {
    opacity: 0.66;
}

.code-box.expand .collapse {
    -webkit-transform: rotate(90deg);
    transform: rotate(90deg);
}
